
import java.util.ArrayList;
import java.util.List;

public class p1012_exam {

	static void calc(List<Integer> circle, int m) {
		System.out.println(circle);
		int p = 0, left;
		while ((left = circle.size()) > 0) {
			p = (p + m - 1) % left;
			/*
			 * p--; for (int i = 0; i < m; i++) { p++; if (p >= left) p = 0; }
			 */
			int v = circle.remove(p);
			System.out.println(p + "\t" + v + ": " + circle);
		}
	}

	public static void main(String[] args) {
		int n = 10, m = 6;
		List<Integer> circle = new ArrayList<Integer>();
		for (int i = 1; i <= n; i++)
			circle.add(i);
		calc(circle, m);
	}

}
